/*
 * SpaceApp.h
 *
 *  Created on: 21 jan 2010
 *      Author: FIDD
 */

#ifndef SPACEAPP_H_
#define SPACEAPP_H_

#include "engine/SDLApp.h"
#include "engine/text/Console.h"
#include "Player.h"
#include <vector>
#include <SDL/SDL.h>
#include <string>

using namespace std;


class Sprite;
class StringInput;
class SpaceClient;
class SpaceServer;
class SpaceMenu;

class SpaceApp : public SDLApp {
public:
	SpaceApp(int w, int h, int bpp, char *title);
	virtual ~SpaceApp();
	void dostring(string str);
	static void print(string msg, int x, int y);
	static void addPlayer(Player *p);
	void emptyPlayers(){players.clear();}
	void setPlayerIndex(int i){playerIndex=i;}
	int getPlayerIndex(){return playerIndex;}
	vector<Player*> getPlayers(){ return players; }


private:
	void init();
	void handleEvents(SDL_Event *e);
	void handleInput();
	void update(int elapsed);
	void draw();

	static vector<Player*> players;
	static vector<string> messages;
	Sprite *ship;
	SpaceMenu *menu;
	Sprite *background;
	Console *console;
	SpaceClient *client;
	SpaceServer *server;
	int before;
	int follow;
	int playerIndex;

};

#endif /* SPACEAPP_H_ */
